<?php
/**
 * Created by PhpStorm.
 * User: wubiaoyang
 * Date: 15-7-5
 * Time: 上午2:53
 */

class starbuy_mdl_special_goods extends dbeav_model{

    public function getGList($cols='*', $filter=array(), $offset=0, $limit=-1, $orderType='id desc',&$total=false){
        $sql = "select $cols from ".kernel::database()->prefix.'starbuy_special_goods'.' left join '.kernel::database()->prefix.'b2c_products'.' p on p.product_id = sdb_starbuy_special_goods.product_id where '.$this->_filter($filter).' group by p.goods_id';
        $sql .= ' order by '.(is_array($orderType) ? implode($orderType,' ') : $orderType);
        return $this->db->selectLimit($sql,$limit,$offset);
    }
    public function getGcount($filter=array()){
        $sql = "select * from ".kernel::database()->prefix.'starbuy_special_goods'.' left join '.kernel::database()->prefix.'b2c_products'.' p on p.product_id = sdb_starbuy_special_goods.product_id where '.$this->_filter($filter).' group by p.goods_id';
        $re = $this->db->selectLimit($sql);
        return count($re);
    }

}